package com.huike.report.service.impl;

import com.huike.clues.mapper.TbClueMapper;
import com.huike.report.mapper.ReportMapper;
import com.huike.report.service.CueConversionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
@Service
public class CueConversionServiceImpl implements CueConversionService {


    @Autowired
    private TbClueMapper tbClueMapper;



    @Override
    public List<Map<String, Object>> getCueConversion(String beginCreateTime, String endCreateTime) {
        List<Map<String, Object>> cueConversion = tbClueMapper.getCueConversion(beginCreateTime, endCreateTime);
        int cluesNumAll = tbClueMapper.getCluesNumAll(beginCreateTime, endCreateTime);
        for (Map<String, Object> stringObjectMap : cueConversion) {
            Integer num =Integer.valueOf(stringObjectMap.get("num").toString());
            BigDecimal bigDecimal = new BigDecimal(num);
            BigDecimal bigDecimal1 = new BigDecimal(cluesNumAll);
            BigDecimal divide = bigDecimal.divide(bigDecimal1, 4, BigDecimal.ROUND_HALF_UP);
            stringObjectMap.put("radio",divide);
        }
        return cueConversion;
    }
}
